/**
 * Created by shudong.msd(风骐) on 2016/4/17.
 */


app.directive('oldValidate', function () {
    return {
        require: 'ngModel',
        link: function (scope, elem, attrs, ctrl) {
            elem.on('blur', function () {
                scope.validateOldPwd(elem.val()).then(function(data){
                    ctrl.$setValidity('pwMatch', data);
                    if(!scope.$$phase) {
                        scope.$apply();
                    }
                });
            });
        }
    };
});